<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>添加项目类型</title>
    <div th:include="layout/resources :: resources"></div>
<body>
<div class="container-fluid">
    <form role="form" id="form">
        <div class="form-group">
            <label>Fun</label> <input class="form-control" name="fun" type="text">
        </div>
        <div class="form-group">
            <label>项目名</label> <input class="form-control" name="describe" type="text">
        </div>
        <button type="button" onclick="add();" class="btn btn-default">添加</button>
    </form>

</div>
</body>
<script type="text/javascript">
    function add() {
        $.ajax({
            method: "post",
            url: createUrl("/fun/add"),
            data:$("form").serialize(),
            success: function (result) {
                if (result.success) {
                    parent.refresh();
                    framework.alert("添加成功");
                } else {
                    framework.alert("添加失败:" + result.error);
                }
                parent.layer.close(index);
            }
        })
    }
</script>
</html>
